import pandas as pd
import tushare as ts

ts.set_token('79966309fa6b430b6cff21c6bfa6fc4b4a0b528560ebfe890bf80385')
pro = ts.pro_api()
# df = pro.index_daily(ts_code='000016.SH',start_date='20220101',end_date='20220201')
# df = pro.us_basic()
# df = pro.us_tradecal(start_date='20240101', end_date='20240501')
# df = pro.us_daily(trade_date='20240507')
df = pro.daily(ts_code='603019.SH', start_date='20240701', end_date='20240801')
df['Datetime'] = pd.to_datetime(df['trade_date'])
df.set_index("Datetime", inplace=True)
df['openinterest'] = 0
df.rename(columns={'vol': 'volume'}, inplace=True)

df = df[['open', 'high', 'low', 'close', 'volume', 'openinterest']]

print(df)
